Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix amusifier Python 3.13 compatibility #1083

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

LourensVeen
Copy link
Collaborator

@LourensVeen LourensVeen commented Oct 23, 2024

Here are some small fixes to make the amusifier not crash on Python 3.13. I've tested this manually on 3.13 and also on 3.8 to check for regressions, and it works on both.

To explain:

In attributes.py, dict is the namespace of the class, so it contains the parameter declarations in the classes but also a bunch of variables made by Python. The latter all have dunder names, the former don't, but instead of checking the name of the key, we check the type of the value. Python 3.13 added a new variable that happens to have an empty tuple as its value, so we crash.

In base.py, function is None (by design, apparently) and None used to have a __doc__ that was None, but in Python 3.13 it's a string describing the None object. So it's no longer the case that any object that has a __doc__ also has a __name__, because now None has the former but not the latter. That was questionable anyway. So there's an extra check for None here.

Fixes #1082

@LourensVeen LourensVeen requested a review from a team as a code owner October 23, 2024 15:46
Copy link
Member

@rieder rieder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK and test-building hermite works with this patch on Py3.13

@rieder rieder merged commit ceadd59 into amusecode:main Oct 28, 2024
5 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Amusifier breaks on Python 3.13
2 participants